package com.sungohealth.schedule;

import com.sungohealth.handler.ReportRuleTaskHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;

import javax.annotation.Resource;

/**
 * 报告任务
 *
 * @author :Liangzy (Potato)
 * @date: 2022-05-03 21:43
 */
@Slf4j
public class ReportScheduleTask {

    /**
     * 处理器
     */
    @Resource
    private ReportRuleTaskHandler reportRuleTaskHandler;

    @Scheduled(cron = "0 0 01 ? * * ")
    public void execTask() {
        log.info("阶段性报告开始执行");
        boolean exec = reportRuleTaskHandler.exec();
        if (exec) {
            log.info("阶段性报告执行完成");
        } else {
            log.error("阶段性报告执行失败");
        }
    }
}
